﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace SimpleSamplesXNA
{
    static class PaintPicker
    {
        public static Texture2D[] textures = new Texture2D[3];
        public static Vector2 upPoint = new Vector2(0,0);
        public static Vector2 downPoint = new Vector2(0, 0);

        public static int maxPics = 3;//max number of pics
        public static Texture2D[] pictures = new Texture2D[maxPics];

        public static int selectedPicture = 0;

        static public void drawPaintPickerMenu(SpriteBatch spriteBatch, int width, int height, SpriteFont Font)
        {
            if (upPoint.Y == 0)
            {
                upPoint = new Vector2(width - (width / 4), (height / 7));
                downPoint = new Vector2(width - (width / 5), height - (height / 7));
            }

            spriteBatch.Draw(textures[0], new Rectangle(0, 0, width, height), Color.White);//draws menu backing
            spriteBatch.Draw(textures[1], new Rectangle((int)upPoint.X, (int)upPoint.Y, 50, 50), Color.White);//draws menu backing
            spriteBatch.Draw(textures[2], new Rectangle((int)downPoint.X, (int)downPoint.Y, 50, 50), Color.White);//draws menu backing
            spriteBatch.Draw(pictures[selectedPicture], new Rectangle(width / 4, height / 4, pictures[selectedPicture].Width, pictures[selectedPicture].Height), Color.White);//draws menu backing
            spriteBatch.DrawString(Font, "Choose Paint\nWith Arrows", new Vector2(width/3, downPoint.Y), Color.White);
        }

        public static void incrementPic()
        {
            
            if (!(selectedPicture == maxPics-1))
                ++selectedPicture;

            if (selectedPicture == 0)
                GloabalStates.chosenPaint = GloabalStates.ChosenPaintenum.Spere;
            else if (selectedPicture == 1)
                GloabalStates.chosenPaint = GloabalStates.ChosenPaintenum.Platform;
            else if (selectedPicture == 2)
                GloabalStates.chosenPaint = GloabalStates.ChosenPaintenum.Edge;
        }

        public static void decrementPic()
        {
            
            if (!(selectedPicture <= 0))
                --selectedPicture;

            if (selectedPicture == 0)
                GloabalStates.chosenPaint = GloabalStates.ChosenPaintenum.Spere;
            else if (selectedPicture == 1)
                GloabalStates.chosenPaint = GloabalStates.ChosenPaintenum.Platform;
            else if (selectedPicture == 2)
                GloabalStates.chosenPaint = GloabalStates.ChosenPaintenum.Edge;
        }





    }
}
